package com.link4a.doms.dao;

/**
 * @author brown
 */
public class AbstractPagination implements Pagination {

	private int page = 1;

	private int pageSize = 15;

	public AbstractPagination() {
	}

	public AbstractPagination(int page, int pageSize) {
		this.page = page;
		this.pageSize = pageSize;
	}

	public void setPage(int page) {
		this.page = page;
	}

	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	@Override
	public int getPage() {
		return page;
	}

	@Override
	public int getPageSize() {
		return pageSize;
	}

	@Override
	public int getFirstRow() {
		return ((page - 1) * pageSize + 1);
	}

	@Override
	public int getLastRow() {
		return (page * pageSize);
	}

	@Override
	public int getOffset() {
		return (getFirstRow() - 1);
	}

}
